//
//  WYCMeWalletController.m
//  51信用卡
//
//  Created by 中企互联 on 2017/11/2.
//  Copyright © 2017年 中企互联. All rights reserved.
//

#import "WYCMeWalletController.h"
#import "WYCRechargeController.h"
#import "WYCDrawalsController.h"
#import "QLCycleProgressView.h"
#import "XYWaterWaveView.h"
#import "WYCBenefitController.h"
#import "WYCDrawalsController.h"


@interface WYCMeWalletController ()
@property (nonatomic, strong) QLCycleProgressView *progressView;

@end

@implementation WYCMeWalletController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
    
    //界面布局
    [self setupCreat];
    
    
    //底部的充值和提ui
//    [self setupBotton];
    
    
    
}

- (QLCycleProgressView *)progressView {
    CGFloat H = NavHeight;
    if (!_progressView) {
        _progressView = [[QLCycleProgressView alloc]initWithFrame:CGRectMake(160 * px, 200, ScreenWidth - 320 * px, _progressView.width)];
    }
    return _progressView;
}

#pragma make ------->>底部的提现和充值

#pragma make ------->>界面布局
- (void)setupCreat{
    
    self.navigationItem.title = @"我的钱包";
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
    [self.navigationController.navigationBar setBarTintColor:WYCMain];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
//    self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTitle:@"分润明细" target:self action:@selector(rightClick)];
    
    
    [self.view addSubview:self.progressView];
    _progressView.progress = 1;
    
    
    UIButton * backButton = [[UIButton alloc] init];
    backButton.frame = CGRectMake(80 * px, 1100 * px, ScreenWidth - 160 * px, 150 * px);
    [backButton addTarget:self action:@selector(backButtonClick) forControlEvents:UIControlEventTouchUpInside];
    [backButton setTitle:@"提现" forState:UIControlStateNormal];
    backButton.titleLabel.font = [UIFont systemFontOfSize:BigFont];
    [backButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    backButton.layer.cornerRadius = 75 * px;
    backButton.backgroundColor = WYCMain;
    [self.view addSubview:backButton];
    
    
    XYWaterWaveView *waveView = [[XYWaterWaveView alloc] initWithFrame:CGRectMake(0, ScreenHeight - 120, ScreenWidth, 120)];
    [self.view addSubview:waveView];
    
//    UILabel * moneylabel = [[UILabel alloc] init];
//    moneylabel.frame = CGRectMake(backButton.x, CGRectGetMaxY(backButton.frame) + 120 * px, backButton.width, 60 * px);
//    moneylabel.text = @"0.00";
//    moneylabel.font = MiddleLight;
//    moneylabel.textAlignment = NSTextAlignmentCenter;
//    moneylabel.font = [UIFont systemFontOfSize:BigMiddleFont];
//    moneylabel.textColor = WYCMain;
//    [self.view addSubview:moneylabel];
    
    
    
//    UILabel * money = [[UILabel alloc] init];
//    money.frame = CGRectMake(moneylabel.x, CGRectGetMaxY(moneylabel.frame) + 80 * px, moneylabel.width, 60 * px);
//    money.text = @"累计分润(元）";
//    money.font = MiddleLight;
//    money.textAlignment = NSTextAlignmentCenter;
//    money.font = [UIFont systemFontOfSize:BigMiddleFont];
//    money.textColor = WYCMain;
//    [self.view addSubview:money];
    
//    //界面背景颜色
//    self.view.backgroundColor = WYCGlobalBg;
//    UIView * backView = [[UIView alloc] init];
//    backView.backgroundColor = [UIColor whiteColor];
//    backView.frame = CGRectMake(0, 0, ScreenWidth, 880 * px);
//    [self.view addSubview:backView];
//
//    //Nav添加控件
//    UIView *navView = [[UIView alloc] init];
//    navView.frame = CGRectMake(0, 40 * px, ScreenWidth, 160 * px);
//    navView.backgroundColor = trpColor;
//    [backView addSubview:navView];
//
//    //返回按钮
//    UIButton * backButton = [[UIButton alloc] init];
//    backButton.frame = CGRectMake(20 * px, 40 * px, 80 * px, 80 * px);
//    [backButton addTarget:self action:@selector(backButtonClick) forControlEvents:UIControlEventTouchUpInside];
//    [backButton setImage:[UIImage imageNamed:@"Nav_back"] forState:UIControlStateNormal];
//    [navView addSubview:backButton];
//
//
//    //Nav钱包
//    UILabel * NavLabel = [[UILabel alloc] init];
//    NavLabel.frame = CGRectMake(ScreenWidth / 2 - 120 * px, 40 * px, 240 * px, 60 * px);
//    NavLabel.text = @"我的钱包";
//    NavLabel.font = MiddleLight;
//    NavLabel.font = [UIFont boldSystemFontOfSize:BigMiddleFont];
//    NavLabel.textColor = [UIColor whiteColor];
//    [navView addSubview:NavLabel];
//
//
//    //金额数量
//    UILabel * maneylabel = [[UILabel alloc] init];
//    maneylabel.frame = CGRectMake(0, CGRectGetMaxY(NavLabel.frame) + 120 * px, ScreenWidth, 100 * px);
//    maneylabel.textColor = [UIColor whiteColor];
//    maneylabel.text = @"10000.00";
//    maneylabel.font = [UIFont systemFontOfSize:SuperBigFont];
//    maneylabel.textAlignment = NSTextAlignmentCenter;
//    maneylabel.font = [UIFont boldSystemFontOfSize:SuperBigFont];
//    [navView addSubview:maneylabel];
//
//    //当前账户余额
//    UILabel * currentaccountlabel = [[UILabel alloc] init];
//    currentaccountlabel.frame = CGRectMake(0, CGRectGetMaxY(maneylabel.frame) + 80 * px, ScreenWidth, 100 * px);
//    currentaccountlabel.textColor = [UIColor whiteColor];
//    currentaccountlabel.text = @"当前账户余额";
//    currentaccountlabel.font = [UIFont systemFontOfSize:WyzFont];
//    currentaccountlabel.textAlignment = NSTextAlignmentCenter;
//    [navView addSubview:currentaccountlabel];
//
//
//    UIView *PinkbackView = [[UIView alloc] init];
//    PinkbackView.frame = CGRectMake(0, CGRectGetMaxY(currentaccountlabel.frame) + 80 * px, ScreenWidth, 280 * px);
//    PinkbackView.backgroundColor = WYCRGBColor(228, 1, 74);
//    [navView addSubview:PinkbackView];
//
//
//    //颜色渲染不清晰加一条线解决
//    UIView *PinklineView = [[UIView alloc] init];
//    PinklineView.frame = CGRectMake(0, 0, ScreenWidth, 1);
//    PinklineView.backgroundColor = WYCRGBColor(228, 29, 92);
//    [PinkbackView addSubview:PinklineView];
//
//
//    //返佣收益
//    UILabel * ProfitLable = [[UILabel alloc] init];
//    ProfitLable.frame = CGRectMake(0, 40 * px, PinkbackView.width / 2, PinkbackView.height / 2 - 20 * px);
//    ProfitLable.text = @"500.00";
//    ProfitLable.textColor = [UIColor whiteColor];
//    ProfitLable.font = [UIFont systemFontOfSize:BigFont];
//    ProfitLable.textAlignment = NSTextAlignmentCenter;
//    [PinkbackView addSubview:ProfitLable];
//
//
//    //返佣收益提示
//    UILabel * showProfitLable = [[UILabel alloc] init];
//    showProfitLable.frame = CGRectMake(0, CGRectGetMaxY(ProfitLable.frame), PinkbackView.width / 2, PinkbackView.height / 2 - 20 * px);
//    showProfitLable.text = @"返佣收益";
//    showProfitLable.textColor = [UIColor whiteColor];
//    showProfitLable.font = [UIFont systemFontOfSize:SmallFont];
//    showProfitLable.textAlignment = NSTextAlignmentCenter;
//    [PinkbackView addSubview:showProfitLable];
//
//
//
//    //分割线
//    UIView * DivisionView = [[UIView alloc] init];
//    DivisionView.frame = CGRectMake(ScreenWidth / 2, 40 * px, 1, PinkbackView.height - 80 * px);
//    DivisionView.backgroundColor = [UIColor whiteColor];
//    [PinkbackView addSubview:DivisionView];
//
//
//
//    //银行卡张数
//    UILabel * NumberLable = [[UILabel alloc] init];
//    NumberLable.frame = CGRectMake(CGRectGetMaxX(DivisionView.frame), 40 * px, PinkbackView.width / 2, PinkbackView.height / 2 - 20 * px);
//    NumberLable.text = @"5";
//    NumberLable.textColor = [UIColor whiteColor];
//    NumberLable.font = [UIFont systemFontOfSize:BigFont];
//    NumberLable.textAlignment = NSTextAlignmentCenter;
//    [PinkbackView addSubview:NumberLable];
//
//
//    //返佣收益提示
//    UILabel * showcardLable = [[UILabel alloc] init];
//    showcardLable.frame = CGRectMake(NumberLable.x, CGRectGetMaxY(NumberLable.frame), PinkbackView.width / 2, PinkbackView.height / 2 - 20 * px);
//    showcardLable.text = @"银行卡";
//    showcardLable.textColor = [UIColor whiteColor];
//    showcardLable.font = [UIFont systemFontOfSize:SmallFont];
//    showcardLable.textAlignment = NSTextAlignmentCenter;
//    [PinkbackView addSubview:showcardLable];
    
    
    
}

#pragma make ------>>充值事件
- (void)RechargeButtonClick{
    WYCRechargeController * recharge = [[WYCRechargeController alloc] init];
    [self.navigationController pushViewController:recharge animated:NO];
    
}


#pragma make ------>>提现事件
- (void)WithdrawalsButtonClick{
    WYCDrawalsController * drawals = [[WYCDrawalsController alloc] init];
    [self.navigationController pushViewController:drawals animated:NO];
    
}

#pragma make ------>>进入控制器隐藏
//- (void)viewWillAppear:(BOOL)animated {
//    [super viewWillAppear:animated];
//    
//    [self.navigationController setNavigationBarHidden:YES animated:YES];
//}
//#pragma make ------>>离开控制器显示
//- (void)viewWillDisappear:(BOOL)animated {
//    [super viewWillDisappear:animated];
//    
//    [self.navigationController setNavigationBarHidden:NO animated:YES];
//}

#pragma mark -------->>分润明细
- (void)rightClick{
    WYCLogFunc;
    WYCBenefitController * Bennefit = [[WYCBenefitController alloc] init];
    [self.navigationController pushViewController:Bennefit animated:NO];
    
}

#pragma make -------->>返回按钮点击事件
- (void)backButtonClick{
    
    [self showToast:@"努力开发中..."];
    
}

- (void)viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];
    
    
    
    self.navigationController.navigationBar.hidden = YES;
    
    
    UIView * NavView = [[UIView alloc] init];
    NavView.frame = CGRectMake(0, 0, ScreenWidth, NavHeight);
    NavView.backgroundColor = WYCmainColor;
    [self.view addSubview:NavView];
    
    
    
    CALayer *bottomLineLayer = [[CALayer alloc] init];
    bottomLineLayer.frame = CGRectMake(0, NavView.bounds.size.height - 0.5, NavView.bounds.size.width, 0.5);
    bottomLineLayer.backgroundColor = WYCmainColor.CGColor;
    [NavView.layer addSublayer:bottomLineLayer];
    
    
    
    
    
    //返回按钮
    UIButton *  fanhuibutton = [[UIButton alloc] init];
    [fanhuibutton setImage:[UIImage imageNamed:@"Nav_back"] forState:UIControlStateNormal];
    [fanhuibutton addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
    fanhuibutton.frame = CGRectMake(30 * px, titleY, 66 * px , 66 * px);
    [NavView addSubview:fanhuibutton];
    
    
    UILabel * NavRigsterLabel = [[UILabel alloc] init];
    NavRigsterLabel.frame = CGRectMake(0, titleY, NavView.width, 68 * px);
    NavRigsterLabel.textColor = [UIColor whiteColor];
    NavRigsterLabel.font = [UIFont boldSystemFontOfSize:BigFont];
    NavRigsterLabel.textAlignment = NSTextAlignmentCenter;
    NavRigsterLabel.text = @"我的钱包";
    [NavView addSubview:NavRigsterLabel];
}
- (void)backClick{
    
    [self.navigationController popViewControllerAnimated:YES];
}
@end
